package com.lanxiao.cloud.common.core.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author ：qiaoliang
 * @date ：2021-08-19
 */
@ApiModel("树形结构返回模型")
public class TreeNodeDto<T> extends Dto<T> {
  @ApiModelProperty(value = "父级ID")
  protected T parentId;
  @ApiModelProperty(value = "子级集合")
  protected List<TreeNodeDto> children = new ArrayList<TreeNodeDto>();

  public TreeNodeDto(T id, T parentId) {
    super(id);
    this.parentId = parentId;
  }

  public void add(TreeNodeDto node) {
    children.add(node);
  }

  public T getParentId() {
    return parentId;
  }

  public List<TreeNodeDto> getChildren() {
    return children;
  }

  public void setChildren(List<TreeNodeDto> children) {
    this.children = children;
  }

}
